import allure
from selenium.webdriver.common.by import By
from pages.base_page import BasePage
from settings import ENV

class LandingPage(BasePage):
    #页面元素定位
    #按钮——立即体验
    bt_try = (By.XPATH,"//button[@class='_home-button_fy4rd_1 _shannon-primary-apply-buttons-immediately_1re7l_78']")
    #按钮——申请商务合作
    bt_cor = (By.XPATH,"//div[@class='_home-button-wrapper_fy4rd_19 _home-button-wrapper-mobile_fy4rd_26']//button[@class='_home-button_fy4rd_1']")


    def __init__(self, driver):
        #初始化
        super().__init__(driver)
        self.driver = driver

    @allure.feature("打开落地页")
    def open_landing_page(self):
        #打开落地页
        self.open_url(ENV.URL_ushannon_landing_page_dev)

    @allure.feature("跳转登录页")
    def to_login_page(self):
        #跳转登录页
        self.l_click(self.bt_try)
        self.switch_to_tab(1)

    @allure.feature("跳转商务合作页")
    def to_cor_page(self):
        #跳转商务合作页
        self.l_click(self.bt_cor)
        self.switch_to_tab(1)



